Interface and Application Programming


What is Interface and Application Programming?

An application interface or user interface is the set of features an application provides so that a user may supply input to and receive output from the program. For this assignment, we are tasked to write an application that interfaces the user with an input or output device that we made.

Download software

In this assignment, I will be using Processing 4.0.1 which can downloaded from here After downloading, I will have to extract the zip file in order to open Processing.exe

First program

Inside the website there are multiple tutorial for us to learn. Below is an example of a tutorial code.

What does the code do?

This program creates a window that is 480 pixels wide and 120 pixels high, and then starts drawing white circles at the position of the mouse. When a mouse button is pressed, the circle color changes to black.

Second program

The second program we did was to code a led light up whenever the pushbutton is being pressed.

Arduino Code: The code is obtain from here

Serial.swap(1) was added to change the Txd & Rxd ports to the alternative serial ports


Led will light up when I press the push button

Third program

Using processing.exe to code when pushbutton pressed it will be red otherwise it will be green

Not Pressed
Pressed

Processing.exe Code:

    1. I first drew a rectangular window (200x200).
    2. Then, I select the correct com port after looking at the arduino ide: COM5.
    3. Set background to white and if serial value is 0 it will be green, serial value 1 it will be red
    4. Setting the color for the box: 0, 255, 21 (green) and 255, 0, 0 (red).